home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 222 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.2 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c,comp.std.c
  4. Subject: Re: Integral conversion e.t.c. (was: Re: Hungarian notation)
  5. Date: Mon, 29 Jan 96 23:55:02 GMT
  6. Organization: none
  7. Message-ID: <822959702snz@genesis.demon.co.uk>
  8. References: <30C40F77.53B5@swsbbs.com> <DLtABq.Fzu@mv.mv.com> <4edqh2$rvl@solutions.solon.com> <KANZE.96Jan29121956@slsvewt.lts.sel.alcatel.de> <4eindq$eju@solutions.solon.com>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4eindq$eju@solutions.solon.com>
  15.            seebs@solutions.solon.com "Peter Seebach" writes:
  16.  
  17. >I would tend to expect a diagnostic in strict ANSI mode, and would also
  18. >expect a diagnostic for including <sys/stat.h> in strict ANSI mode.  Neither
  19. >is often forthcoming.
  20.  
  21. ANSI doesn't require a diagnostic for either of those so an implementation
  22. that follows the letter of the standard doesn't have to diagnose either
  23. of them. Your compiler may have an extra feature (i.e. not required by the
  24. standard) where it tries to diagnose code that isn't strictly conforming.
  25. In the general case that's a hopeless task since many forms of system
  26. dependency are not detectable at compile time but you might expect such a
  27. compiler to diagnose the cases above. I have yet to come across a compiler
  28. that attempts to do this however, it probably isn't all that useful
  29. in practice.
  30.  
  31. >gcc warns only on implementations where they consider it a hosted environment;
  32. >on most systems, they weasel and claim to be a freestanding implementation.
  33.  
  34. Since gcc is a compiler that doesn't come with a library, in itself it
  35. can't be a hosted implementation. Where it is used with other people's
  36. libraries calling it a hosted implementation implies taking responsibility
  37. for those libraries. I certainly wouldn't be keen on doing that!
  38.  
  39. >>Normally, I would expect (at the very least) a compiler to generate a
  40. >>warning or an error for a main that it did not support.  In fact,
  41. >>however, my compiler (gcc) accepts the following definition without
  42. >>the slightest complaint, although I'd rather not think about what will
  43. >>happen when I access parameter d:
  44. >
  45. >>       int main( char a , int b , long c , double d )
  46. >
  47. >I think that may actually legitimately require a diagnostic; 5.1.2.2.1 gives
  48. >us a constraint (?) of "If they are defined, the parameters to the main
  49. >function shall obey the following constraints: ..." and some definitions.
  50.  
  51. Interesting observation. I expect that the constraints referred to in
  52. 5.1.1.3 are the constraint sections. This is worth clarifying though.
  53.  
  54. >I would take this as implying that main *must* conform.  I would like to see
  55. >them go from "can be declared" to "shall be declared".
  56.  
  57. That makes no difference. Violation of a 'shall' clause results in
  58. undefined behaviour in the same way as a lack of definition. See 3.16
  59. (which I just included in a post prior to this). To require a diagnostic
  60. you would need to create a constraints section.
  61.  
  62. -- 
  63. -----------------------------------------
  64. Lawrence Kirby | fred@genesis.demon.co.uk
  65. Wilts, England | 70734.126@compuserve.com
  66. -----------------------------------------
  67.